﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using YAPL.Language.SourceParser;
using YAPL.Language.Ast;
using YAPL.Language.SourceParser.Antlr;
using YAPL.Language.SourceParser.XML;
using YAPL.Util;
using Xunit;

namespace YAPL.Test {
	public static class TestHelper {
		public const string RELATIVE_FIXTURE_PATH = @"..\..\..\YAPL.Test\Fixtures\";
		public const string PEVERIFY_UTILITY_PATH = @"..\..\..\Tools\PEVerify.exe";
		public static Expression GetAstFromXML(string path) {
			var inputInfo = new InputInfo(path);
			var parser = new XmlInputParser(inputInfo);
			var expr = parser.ParseInput();
			return expr;
		}
		public static Expression GetAstFromYAPL(string path) {
			var inputInfo = new InputInfo(path);
			var parser = new AntlrInputParser(inputInfo);
			var expr = parser.ParseInput();
			return expr;
		}
		public static string PathToFixture(string fileName) {
			return Path.Combine(Directory.GetCurrentDirectory(), RELATIVE_FIXTURE_PATH + fileName);
		}
		public static ILVerifier GetVerificationHelper() {
			return new ILVerifier(PEVERIFY_UTILITY_PATH);
		}

	}
}
